import service from '@/utils/request';
import config from '@/config/index.js';


const servletMap = [
    // 上传资料
    ['/kc/course/video/upload-handout', 'upload', 'post'],
    ['/kc/course/video/sync', 'sync', 'post'],
    ['/kc/course/video/save-video-records', 'saveRecords', 'post'],
    ['/kc/course/video/save-lastid-column', 'saveColumn', 'post'],
    ['/kc/course/video/aliyun-auth', 'auth', 'post'],
    ['/kc/course/video/list-by-chapter', 'list', 'get'],

    ['/kc/course/live/videoList', 'videoList', 'get'],


    ['/kc/course/video/handout/list-by-video', 'handoutList', 'get'],
    ['/kc/course/video/handout/add-frequency', 'addFrequency', 'put'],

    ['/kc/course/video/chapter/list-by-column', 'chapterList', 'get'],
    ['/kc/course/video/chapter/child-chapter', 'childChapter', 'get'],
    ['/user/sys/group/watermark', 'watermark', 'get'],
    ['/kc/course/live/appoint', 'appoint', 'post'],
    ['/kc/course/live/haveAppoint', 'haveAppoint', 'get'],
    ['/kc/course/live/live-by-columnId', 'liveByColumnId', 'get'],
    ['/kc/course/live/getResource', 'getResource', 'get']
]
let obj = {};
for (let i in servletMap) {
    obj[servletMap[i][1]] = function () {
        return service[servletMap[i][2]](servletMap[i][0], ...arguments);
    };
}

export default {
    ...obj,
    liveDetail(id) {
        // return service.get('/kc/course/live/detail/' + id)
        return service.get('/kc/course/live/getDetail?id=' + id)
    },
    getVideoRecords(config) {
        return service.get('/kc/course/video/getVideoRecords', config)
    },

    deleteVideoRecords(config) {
        return service.delete('/kc/course/video/delete-video-records', config)
    },
}